/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.foxline.manager;

import br.com.foxline.model.ActCep;
import br.com.foxline.model.City;
import br.com.foxline.service.ActCepService;
import br.com.foxline.service.CityService;
import java.io.Serializable;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

/**
 *
 * @author roniere
 */
@ManagedBean
@ViewScoped
public class ManagerActCep implements Serializable{
    @EJB
    private ActCepService actCepService;
    
    @EJB
    private CityService cityService;
    
    private ActCep actCep;
    
    @PostConstruct
    private void init(){
        actCep = new ActCep();
    }

    public ManagerActCep() {
    }

    
    
    public ActCep getActCep() {
        return actCep;
    }

    public void setActCep(ActCep actCep) {
        this.actCep = actCep;
    }
    
    public void create(){
        actCepService.saveActCep(actCep);
        actCep = new ActCep();
       
    }
    public List<ActCep> autocomplete(String query){
        return actCepService.autoComplete(query);
    }

    public List<City> autocompleteCity(String query){
        return cityService.autocomplete(query);
    }
}
